package org.fto.jthink.ai.example.fg;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 玩家角色
 * 
 * @author wenjian
 */
public class PlayerActor extends Actor{
  BufferedReader reader = null;
  public PlayerActor(){
    this.reader = new BufferedReader(new InputStreamReader(System.in));
  }
  
  public String getHand() throws Exception {
    System.out.print("请出拳(石头，剪子，布)(1,2,3)?");
    String value = reader.readLine();
//    if(value.equals("q") || value.equals("Q")){
//      System.out.println("猜拳游戏结束");
//      game.exit();
//    }
//    if(value.equals("h") || value.equals("H")){
//      game.help();
//      throw new Exception();
//    }
    if(isCorrect(value)){
      return value;
    }else{
      //System.out.println("错误的出拳!");
      //throw new Exception("错误的出拳!");
    }
    throw new Exception(value);
  }
  public boolean isCorrect(String value){
    if(value.equals("1") || value.equals("2") || value.equals("3")){
      return true;
    }else{
      return false;
    }
  }

}
